package com.yanqu.road.entity.activity.peakstronghold;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.union.UnionBaseInfo;
import com.yanqu.road.utils.date.DateHelper;

import java.math.BigInteger;
import java.util.Map;

// 据点战联盟门客赚钱排行,报名期用
@FieldTypeAnnotation(tableName = "t_c_union_ability_rank", autoSave = true)
public class CrossUnionAbilityRankData extends DataObject {
    @FieldTypeAnnotation(select = true, update = true, desc = "活动id", isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(update = true, desc = "索引id", isIndex = true)
    private int rankId;
    @FieldTypeAnnotation(desc = "商会id")
    private String unionId;
    @FieldTypeAnnotation(desc = "商会数据")
    private UnionBaseInfo unionBaseInfo;
    @FieldTypeAnnotation(desc = "门客总赚钱")
    private BigInteger ability = BigInteger.ZERO;
    @FieldTypeAnnotation(desc = "排名")
    private int rank;
    @FieldTypeAnnotation(desc = "更新时间")
    private long lastUpdateTime;

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public int getRankId() {
        return rankId;
    }

    public void setRankId(int rankId) {
        this.rankId = rankId;
    }

    public UnionBaseInfo getUnionBaseInfo() {
        return unionBaseInfo;
    }

    public void setUnionBaseInfo(UnionBaseInfo unionBaseInfo) {
        this.unionBaseInfo = unionBaseInfo;
    }

    public BigInteger getAbility() {
        return ability;
    }

    public void setAbility(BigInteger newAbility) {
        if (this.ability.compareTo(newAbility) != 0) {
            this.ability = newAbility;
            setUpdateOption();
            setLastUpdateTime(DateHelper.getCurrentTime());
        }
    }

    public long getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(long lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        if (this.rank != rank) {
            this.rank = rank;
            setUpdateOption();
        }
    }
}
